package com.baichang.taoshunda.dao.impl;

import com.baichang.framework.model.Page;
import org.springframework.stereotype.Repository;

import com.baichang.framework.dao.impl.BaseDaoImpl;
import com.baichang.taoshunda.dao.BalanceDetailsDao;
import com.baichang.taoshunda.entity.BalanceDetails;

@Repository
public class BalanceDetailsDaoImpl extends BaseDaoImpl<BalanceDetails> implements BalanceDetailsDao {
    /**
     * 用户查询明细表
     *
     * @param id
     * @param nowPage
     * @param pageSize
     * @return
     */
    @Override
    public Page queryMoneyDetails(Integer id, int nowPage, int pageSize) {
        String sql = "SELECT bd.source_type AS sourceType,bd.balance,bd.created FROM t_user tu INNER JOIN t_balance_details bd ON tu.id=bd.user_id WHERE tu.user_state IN (1,2) AND bd.user_id=? ORDER BY bd.created DESC";
        return pageForMapList(sql, nowPage, pageSize, id);
    }
}